<?php
include '_init_.php';
	$orderManager = Order_Manager::getOrderManager($_REQUEST['id']);
if($orderManager == null)
	exit("Not exist");
if($orderManager->getStatus() != Order_Manager::$STATUS_SAVED)
	exit("Not allowed");
$orderManager->init();


$act = isset($_REQUEST['act'])?$_REQUEST['act']:'';
if($act == 'save')
{
	$orderManager->setMainInfo(array('department_worker'=>$_REQUEST['department_worker']));
	$orderManager->persistOrderInfo();
	AppMain::refreshParentFrame();
}

$orderInfo = $orderManager->getInfo();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form action="cosia.php">
<input type="hidden" name="act" value="save"/>
<input type="hidden" name="id" value="<?php echo $orderManager->getId();?>"/>
<div class="mainf-8">
    <ul>
      <li class="maina-1k">預約門市</li>
      <li class="mainf-1m"><img src="images/line5.gif" width="676" height="7" align="top" /></li>
      <li class="mainf-1l"><?php echo Util::html_safe($orderInfo['department']);?></li>
    </ul>
    </div>
    
    <div class="mainf-8">
    <ul>
     <li class="maina-1k">單號確認</li>
      <li class="mainf-1m"><img src="images/line5.gif" width="676" height="7" align="top" /></li>
      <li class="mainf-1a">預約單號 NO.<?php echo Util::html_safe($orderInfo['number']);?></li>
      </ul>
     </div>
    <div class="mainf-8">
    <ul>
      <li class="maina-1k">門市人員</li>
      <li class="mainf-1m"><img src="images/line5.gif" width="676" height="7" align="top" /></li>
      <?php 
      $dtWorker = new DataTable(constant('DB_TABLE_WORKER'));
      $workder_list =  $dtWorker->get_list("`type`=1");
      foreach($workder_list as $tmpData)
      {
      	if($orderInfo['department_worker'] === $tmpData['name'])
      	{
      		printf('<li class="mainf-1c"><input checked="checked" name="department_worker" type="radio" class="mainf-radiobtn"  value="%s" />%s</li>',$tmpData['name'],$tmpData['name']);
      	}else{
      		 printf('<li class="mainf-1c"><input name="department_worker" type="radio" class="mainf-radiobtn" value="%s" />%s</li>',$tmpData['name'],$tmpData['name']);

      	}
      }
      ?>
    </ul>
    </div>

<div class="mainf-7">
<ul>
<li class="article-1g"><input name="" type="button" class="article-1a_btn" value="儲存" onclick="document.forms[0].submit();return false;"/></li>
</ul>
</div>
</form>   
</body>
</html>
